﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cofe.Core.Implements
{
    //public class DirectoryListerBase<T> : IDirectoryLister
    //{
    //    #region Constructor

    //    public DirectoryListerBase(IFactory<IDirectoryLister> factory, string listerKey)
    //    {
    //        _factory = factory;
    //        ListerKey = listerKey;
    //    }

    //    #endregion

    //    #region Methods


    //    protected T getEmbeddedItem(IFileSystemInfo entry)
    //    {
    //        return (T)entry.GetProperty(InternalProperties.EmbeddedEntry).Value;
    //    }

    //    public abstract IEnumerable<IFileSystemInfo> List(IDirectoryInfo parent, EntryConstructionFlags flags);

    //    public virtual IDirectoryInfo GetParent(IFileSystemInfo entry)
    //    {
    //        T embeddedEntry = getEmbeddedItem(entry);
    //        T parentEntry = _getParent(embeddedEntry);
    //        if (parentEntry != null)
    //            return COFEShared.EntryConstructor.CreateDirectory(ListerKey, CreatePropertyProvider(parentEntry));
    //        return null;
    //    }

    //    public virtual void Expand(IFileSystemInfo entry)
    //    {
    //        T embeddedEntry = getEmbeddedItem(entry);
    //        _expand(embeddedEntry, entry.TempPath);
    //    }

    //    public virtual int GetPosition(IFileSystemInfo entry)
    //    {
    //        T embeddedEntry = getEmbeddedItem(entry);
    //        return _getPosition(embeddedEntry);
    //    }

    //    public virtual void SetPosition(IFileSystemInfo entry, int position)
    //    {
    //        T embeddedEntry = getEmbeddedItem(entry);
    //        _setPosition(embeddedEntry, position);
    //    }



    //    #endregion

    //    #region Data

    //    private IVolumeFactory _factory = null;

    //    protected Func<T, IEnumerable<T>> _list = (item) => { return new List<T>(); };
    //    protected Func<T, bool> _isDirectory = (item) => { return false; };
    //    protected Func<T, T> _getParent = (item) => { return default(T); };

    //    protected Action<T, string> _expand = (item, tempPath) => { };
    //    protected Func<T, int> _getPosition = (item) => { return -1; };
    //    protected Action<T, int> _setPosition = (item, pos) => { };

    //    #endregion

    //    #region Public Properties


    //    public string ListerKey { get; set; }

    //    public IFactory<IDirectoryLister> Factory { get { return _factory; } }

    //    #endregion


    //}
}
